#include "userservice.h"

bool UserService::verifyLogin(const QString& username, const QString& password) {
    if (username.isEmpty() || password.isEmpty()) {
        qWarning() << "Username or password cannot be empty";
        return false;
    }

    QString sql = "SELECT password FROM user WHERE username = :username";
    QSqlQuery query = dbManager->execQueryWithParams(sql, [&](QSqlQuery& q) {
        q.bindValue(":username", username);
        return true;
    });

    if (query.next()) {
        return query.value("password").toString() == password;
    }
    return false;
}
